﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/MasterPage.Master"
    Inherits="System.Web.Mvc.ViewPage<SiteChannelDto>" %>
<%@ Import Namespace="Common" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="content">
        <h1>
            创建/编辑网站频道：<a href="<%=Url.Action("List", "Channel")%>">&lt;&lt;返回</a></h1>
        <%
            using (Html.BeginForm("SaveChannel", "Channel", FormMethod.Post, new {enctype = "multipart/form-data"}))
            {%>
        <table class="addData">
            <caption>
                <h2>
                    编辑网站频道
                </h2>
            </caption>
            <tr>
                <td class="alignR">
                    <span class="redTxt">*</span>频道名称
                </td>
                <td>
                    <label>
                        <%=Html.TextBox("Name", Model.ChannelName, new {Class = "textInput"})%>
                        <%=Html.Hidden("Id", Model.ChannelId)%>
                    </label>
                </td>
            </tr>
            <tr>
                <td class="alignR">
                    <span class="redTxt">*</span>使用模板
                </td>
                <td>
                    <label>
                        <select name="TemplateId">
                            <option value="1">天字一号模板</option>
                        </select>
                    </label>
                </td>
            </tr>
            <tr>
                <td class="alignR">
                    <span class="redTxt">*</span>频道标识
                </td>
                <td>
                    <label>
                        <%=Html.TextBox("Code", Model.ChannelCode, new {Class = "textInput"})%>
                    </label>
                </td>
            </tr>
            <tr>
                <td class="alignR">
                    <span class="redTxt">*</span>频道状态
                </td>
                <td>
                    <label>
                        <input type="radio" name="state" value="1" <%=Model.ChannelCurState == 1 ? "checked=\"checked\"" : ""%>/>正常
                        <input type="radio" name="state" value="2" <%=Model.ChannelCurState == 2 ? "checked=\"checked\"" : ""%>/>停用
                    </label>
                </td>
            </tr>
            <tr>
                <td class="alignR">
                    <span class="redTxt">*</span>频道图片
                </td>
                <td>
                    <input type="file" name="FileImg" />
                    <%=Html.Hidden("ImgIds",
                                              string.IsNullOrEmpty(Model.ChannelIndexImg) ? "," : Model.ChannelIndexImg)%>
                    <%
                var imgs = ViewData["ChannelImgs"] as List<AnnexDto>;%>
                    <%
                if (imgs != null && imgs.Count > 0)
                {%>
                    <table class="listTable">
                        <tr>
                            <th>
                                图片名称
                            </th>
                            <th>
                                顺序
                            </th>
                            <th class="alignR">
                                操作
                            </th>
                        </tr>
                        <%
                    int i = 1;%>
                        <%
                    foreach (AnnexDto img in imgs)
                    {%>
                        <tr>
                            <td>
                                <%=img.AnnexName%>
                            </td>
                            <td>
                                <%=i%>
                            </td>
                            <td class="alignR">
                                <a href="#">上移</a> | <a href="#">下移</a> | <a href="#">删除</a>
                            </td>
                        </tr>
                        <%
                        i++;%>
                        <%
                    }%>
                    </table>
                    <%
                }%>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    <label>
                        <input type="submit" name="button" id="button" value="保存" />
                    </label>
                </td>
            </tr>
        </table>
        <%
            }%>
    </div>
</asp:Content>
